import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/home/Home.vue'

Vue.use(Router)

export default new Router({
	routes: [{
			path: '/',
			name: 'home',
			component: Home,
			meta: {
				title: "首页"
			}
		},
		{
			path: '/product',
			name: 'product',
			component: () => import( /* webpackChunkName: "product" */ '@/views/product/Product.vue'),
			meta: {
				title: "商品列表"
			}
		},
		{
			path: '/product/detail/:id',
			name: 'productDetail',

			component: () => import( /* webpackChunkName: "product" */ '@/views/product/ProductDetail.vue'),
			meta: {
				title: "商品详情"
			}
		},
		{
			path: '/shopcart',
			name: 'shopcart',

			component: () => import( /* webpackChunkName: "product" */ '@/views/shopcart/Shopcart.vue'),
			meta: {
				title: "购物车",
			}
		},
		{
			path: '/user',
			name: 'user',

			component: () => import( /* webpackChunkName: "product" */ '@/views/user/User.vue'),
			meta: {
				title: "我的"
			}
		},
		{
			path: '*',
			name: 'notfound',

			component: () => import( /* webpackChunkName: "product" */ '@/views/NotFound.vue'),
			meta: {
				title: "导航页面不存在"
			}
		},
		{
			path: '/collection',
			name: 'collection',
			component: () => import( /* webpackChunkName: "product" */ '@/views/collection/collection.vue'),
			meta: {
				title: "我的收藏"
			}
		},
		{
			path: '/todo',
			name: 'todo',
			component: () => import( /* webpackChunkName: "product" */ '@/views/todo/Todo.vue'),
			meta: {
				title: "todo案例"
			}
		},
		{
			path: "/login",
			component: () => import("@/views/user/Login.vue"),
			name: "login",
			meta: {
				title: "登录"
			}
		},
		{
			path: "/register",
			component: () => import("@/views/user/Register.vue"),
			name: "register",
			meta: {
				title: "用户注册"
			}
		},
		{
			path: "/ruser/profile",
			component: () => import("@/views/user/Profile.vue"),
			name: "profile",
			meta: {
				title: "个人资料"
			}
		},
		{
			path: "/user/updatePwd",
			component: () => import("@/views/user/UpdatePwd.vue"),
			name: "updatePwd",
		 meta: {
				title: "修改密码"
			}
		},
		{
			path: "/order/create",
			component: () => import("@/views/order/OrderCreate.vue"),
			name: "orderCreate",
			meta: {
				title: "新建订单",
			},
		},
		{
			path: "/address/AddressList",
			component: () => import("@/views/address/AddressList.vue"),
			name: "addressList",
			meta: {
				title: "收货地址列表",
				requireAuth: true
			}
		},
		{
			path: "/address/AddressEdit/:id",
			component: () => import("@/views/address/AddressEdit.vue"),
			props: true,
			name: "addressEdit",
			meta: {
				title: "收货地址",
				requireAuth: true
			},
		},
		{
			path: "/order/list",
			component: () => import("@/views/order/OrderList.vue"),
			name: "orderList",
			meta: {
		 	title: "我的订单",
				requireAuth: true
			},
		},
		{
			path: "/order/detail/:id",
			component: () => import("@/views/order/OrderDetail.vue"),
			props: true,
			name: "orderDetail",
			meta: {
				title: "订单详情",
				requireAuth: true
			},
		},
	]
})
